<!DOCTYPE html>
<html lang="en">
<head th:insert="/admin/common/head::css"></head>
<body>
<div th:insert="/admin/common/header::header" ></div>
<!--  main  -->
<div class="container-fluid">
    <div class="row-fluid">
        <div th:insert="/admin/common/side::side" ></div>
        <!-- content  内容页面的代码放这里 -->
        <div style="display: flex; flex-direction: column">
            <div class="span10" id="content">
                <div class="row-fluid">
                    <!-- block -->
                    <div class="block">
                        <div class="navbar navbar-inner block-header" >
                            <a class="btn btn-default" th:href="@{/admin/resource/add.html}" role="button">上传图片资源</a>
                            <form method="post" th:action="@{/admin/resource/page}">
                                <input name="search" value=""/>
                                <button type="submit" class="btn btn-primary"  >搜索</button>
                            </form>
                        </div>
                        <div class="block-content collapse in">
                            <div class="span12">
                                <table class="table">
                                    <thead>
                                    <tr>
                                        <th>序号</th>
                                        <th>图片名称</th>
                                        <th>图片关键字</th>
                                        <th>图片</th>
                                        <th>图片上传时间</th>
                                        <th>操作</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    <tr th:each = "resource : ${page.records}">
                                        <td th:text="${resource.id}"></td>
                                        <td th:text="${resource.name}"></td>
                                        <td th:text="${resource.keyword}"></td>
                                        <td style="width: 70%;display: flex; flex-direction: row">
                                            <div class="controls" th:each="url:${resource.urls}">
                                                <img th:src="${url}"/>
                                            </div>
                                        </td>
                                        <td th:text="${#dates.format(resource.time, 'yyyy-MM-dd HH:mm:ss')}"></td>
                                        <td>
                                            <!--            //这样可以拿到对应数据-->
                                            <a class="btn btn-default" th:if="${loginUser.userType==0}" th:href="@{/admin/resource/detail(id = ${resource.id})}" role="button">编辑</a>
                                            <a class="btn btn-default" th:if="${loginUser.userType==0}" th:href="@{/admin/resource/delete(id = ${resource.id})}" role="button">删除</a>
                                        </td>
                                    </tr>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>
                    <!-- /block -->
                </div>
            </div>
            <div th:insert = "/admin/common/page::page"></div>
        </div>
        <!-- content -->
    </div>
</div>
<!--  main  -->
</body>
<div th:insert="/admin/common/footer::js" ></div>

</html>